package util

import (
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
)

func ErrorResponse(ctx *gin.Context, statusCode int, message string) {
	logrus.WithFields(logrus.Fields{
		"status":  statusCode,
		"message": message,
	}).Error(message)

	ctx.JSON(statusCode, gin.H{
		"error": message,
	})
}

func SuccessResponse(ctx *gin.Context, statusCode int, data interface{}) {
	logrus.WithFields(logrus.Fields{
		"status": statusCode,
	}).Info("Request successful")

	ctx.JSON(statusCode, gin.H{
		"data": data,
	})
}
